<%
# View which displays a form for editing a user's data.
#
# Author::      Eli Fox-Epstein, efoxepstein@wesleyan.edu
# Author::      Dimitar Gochev, dimitar.gochev@trincoll.edu
# Copyright::   Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009.
# License::     http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
%>

<% content_for :title, title ('Edit user', @user.full_name, 'Contacts', @instance.short_name)%>

<% content_for :body do%>
<div id="wrap">
<%= flashes %>

	<h1>Edit your account: <%= @user.full_name%></h1>
	<% @user.password = @user.password_confirmation = nil %>
	
	<%= error_messages_for :user %>
	<% form_for [@instance, @user] do |f| -%>
		<p><%= f.label 'email' %><br/>
		<%= f.text_field :email, :title => 'Username' %></p>
		
		<p><%= f.label :desk_phone %><br/>
		<%= f.text_field :desk_phone %></p>
		
		<p><%= f.label :desk_phone_ext, 'Extension' %><br/>
		<%= f.text_field :desk_phone_ext %></p>
		
		<p><%= f.label 'cell_phone' %><br/>
		<%= f.text_field :cell_phone %></p>
		
		<p>Preferred:</p>
		<%= f.radio_button(:preferred_is_cell, true) + f.label(:preferred_is_cell_true, 'Cell') %>
		<%= f.radio_button(:preferred_is_cell, false) + f.label(:preferred_is_cell_false, 'Desk') %>
		
		<p><%= f.label 'carrier' %>
		<%= f.select :carrier_id, Carrier.all.map {|c| [c.name, c.id]}, :include_blank => 'Not Listed', :selected => (@user.carrier && @user.carrier.id) %></p>
	
		<p><%= f.label 'password' %><br/>
		<%= f.password_field :password, :autocomplete => 'off' %></p>
	
		<p><%= label_tag 'password_confirmation', 'Confirm Password' %><br/>
		<%= f.password_field :password_confirmation %></p>
	
		<p><%= submit_tag 'Save' %></p>
	<% end -%>
</div>
<% end %>
